package com.omt.tarjimdinek.domain.tv.controller;

import java.util.List;

import javax.inject.Inject;
import javax.inject.Named;

import org.springframework.context.annotation.Scope;

import com.omt.tarjimdinek.domain.tv.entity.Theme;
import com.omt.tarjimdinek.domain.tv.service.ThemeRepository;

/**
 * Simple pass over to access static 'themeUtil'from EL.
 * Keeps also the user's preferred locale.
 *
 * @see org.springframework.security.web.authentication.AnonymousAuthenticationFilter
 */
@Named("themeUtil")
@Scope("session")
public class ThemeController {

	private List<Theme> listeTheme;
	
	@Inject
	private ThemeRepository themeRepository;
	
	public List<Theme> getAllTheme(){
		if(listeTheme == null){
			listeTheme = themeRepository.findAll();
		}
		return listeTheme;
	}
	
	/**
	 * @return the themeRepository
	 */
	public ThemeRepository getThemeRepository() {
		return themeRepository;
	}

	/**
	 * @param themeRepository the themeRepository to set
	 */
	public void setThemeRepository(ThemeRepository themeRepository) {
		this.themeRepository = themeRepository;
	}
}
